<div class="col-md-8 col-md-offset-2">

<div class="panel panel-default">

  <div class="panel-body">

  	<div ng-repeat='obj in objs' class="row">

      <div ng-switch on='$index' class="col-md-12">
        <div ng-switch-when='0' ng-show="obj.length > 0">
          <Strong>接口名称</Strong><hr>
        </div>
        <div ng-switch-when='1' ng-show="obj.length > 0">
          <br><Strong>接口介绍</Strong><hr>
        </div>
        <div ng-switch-when='2' ng-show="obj.length > 0">
          <br><Strong>接口调用请求说明</Strong><hr>
        </div>
        <div ng-switch-when='3' ng-show="obj.length > 0">
          <br><Strong>参数说明</Strong><hr>
        </div>
        <div ng-switch-when='4' ng-show="obj.length > 0">
          <br><Strong>返回说明</Strong><hr>
        </div>
        <div ng-switch-when='5' ng-show="obj.length > 0">
          <br><Strong>注意事项</Strong><hr>
        </div>
      </div>

  		<div ng-repeat='o in obj'>

        <div ng-show="o.display_type==1">
          <!-- 正常状态 -->
          <div ng-show="o.state==0">
            <div class="col-xs-11">
              <p>{{o.text}}</p>
            </div>
            <div class="col-xs-1">
              <button type="button" 
                class="btn btn-xs btn-info"
                ng-click="edit($parent.$index, $index)"
              >
                <span class="glyphicon glyphicon-edit" aria-hidden="true"></span>
              </button>
              <button type="button" 
                class="btn btn-xs btn-danger"
                ng-click="delete($parent.$index, $index)"
                ng-show="$parent.$index !== 0"
              >
                <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
              </button>
            </div>
          </div>

          <!-- 编辑状态 -->
          <div ng-show="o.state==1">
            <div class="col-xs-11">
              <textarea class="form-control" rows="3" 
              ng-model="objs[$parent.$index][$index].text">{{o.text}}</textarea>
            </div>
            <div class="col-xs-1 text-center">
              <button type="button" 
                class="btn btn-xs btn-info"
                ng-click="ok($parent.$index, $index)"
              >      
                <span class="glyphicon glyphicon-ok" aria-hidden="true"></span>
              </button>
              <input class="form-control" 
                ng-model="o.asort"
                value="o.asort" 
              >
            </div>
          </div>

        </div>


        <div ng-show="o.display_type==2">

          <!-- 正常状态 -->
          <div ng-show="o.state==0">
            <div class="col-xs-11">
              <pre>{{o.text}}</pre>
            </div>
            <div class="col-xs-1">
              <button type="button" 
                class="btn btn-xs btn-info"
                ng-click="edit($parent.$index, $index)"
              >      
                <span class="glyphicon glyphicon-edit" aria-hidden="true"></span>
              </button>
              <button type="button" 
                class="btn btn-xs btn-danger"
                ng-click="delete($parent.$index, $index)"
              >      
                <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
              </button>
            </div>
          </div>

          <!-- 编辑状态 -->
          <div ng-show="o.state==1">
            <div class="col-xs-11">
              <textarea class="form-control" rows="3" 
              ng-model="objs[$parent.$index][$index].text">{{o.text}}</textarea>
            </div>
            <div class="col-xs-1">
              <button type="button" 
                class="btn btn-xs btn-info"
                ng-click="ok($parent.$index, $index)"
              >      
                <span class="glyphicon glyphicon-ok" aria-hidden="true"></span>
              </button>
              <input class="form-control" 
                ng-model="o.asort"
                value="o.asort" 
              >
            </div>
          </div>

          
        </div>



        <div ng-show="o.display_type==0">

          <!-- 正常状态 -->
          <div ng-show="o.state==0">
            <div class="col-xs-11">
              <table class="table table-bordered ">
                <thead>
                  <tr>
                    <th class="col-md-4">参数</th>
                    <th class="col-md-8">描述</th>
                  </tr>
                </thead>
                <tbody>
                  <tr ng-repeat="para in o.display_arr">    
                    <td>{{para.k}}</td>
                    <td>{{para.v}}</td>
                  </tr>
                </tbody>
              </table>
            </div>
            <div class="col-xs-1">
              <button type="button" 
                class="btn btn-xs btn-info"
                ng-click="edit($parent.$index, $index)"
              >      
                <span class="glyphicon glyphicon-edit" aria-hidden="true"></span>
              </button>
              <button type="button" 
                class="btn btn-xs btn-danger"
                ng-click="delete($parent.$index, $index)"
              >      
                <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
              </button>
            </div>
          </div>




          <!-- 编辑状态 -->
          <div ng-show="o.state==1">
            <div class="col-xs-11">
              <table class="table table-bordered ">
                <thead>
                  <tr>
                    <th class="col-md-3">参数</th>
                    <th class="col-md-7">描述</th>
                    <th class="text-center col-md-2">
                    <button type="button" 
                    class="btn btn-success"
                    ng-click="addtr1($parent.$index, $index)"
                    >新增</button>
                  </th>
                  </tr>
                </thead>
                <tbody>
                  <tr ng-repeat="para in o.display_arr"> 
                    <td><input type="text" class="form-control"
                    ng-model="para.k" value="para.k" 
                    ></td>
                    <td><input type="text" class="form-control"
                    ng-model="para.v" value="para.v"
                    ></td>
                    <td class="text-center">
                      <button type="button" 
                      class="btn btn-danger"
                      ng-click="deltr1($parent.$parent.$index, $parent.$index, $index)"
                      >删除</button>
                    </td>   
                    <!-- <td>{{para.k}}</td>
                    <td>{{para.v}}</td> -->
                  </tr>
                </tbody>
              </table>
            </div>
            <div class="col-xs-1">
              <button type="button" 
                class="btn btn-xs btn-info"
                ng-click="ok($parent.$index, $index)"
              >      
                <span class="glyphicon glyphicon-ok" aria-hidden="true"></span>
              </button>
              <input class="form-control" 
                ng-model="o.asort"
                value="o.asort" 
              >
            </div>
          </div>



        </div>



  		</div>

  	</div>

  </div>


</div>




  <div class="panel panel-default">
    <div class="panel-body form-horizontal">
      <div class=" col-md-10">
          <div class="">
            <label class="radio-inline">
              <input type="radio" name="text_type" value="1" ng-model="addm.text_type"> 接口介绍
            </label>
            <label class="radio-inline">
              <input type="radio" name="text_type" value="2" ng-model="addm.text_type"> 接口调用请求说明
            </label>
            <label class="radio-inline">
              <input type="radio" name="text_type" value="3" ng-model="addm.text_type"> 参数说明
            </label>
            <label class="radio-inline">
              <input type="radio" name="text_type" value="4" ng-model="addm.text_type"> 返回说明
            </label>
            <label class="radio-inline">
              <input type="radio" name="text_type" value="5" ng-model="addm.text_type"> 注意事项
            </label>
          </div>
          <hr>
          <div class="">
            
            <label class="radio-inline">
              <input type="radio" name="display_type" value="1" ng-model="addm.display_type"> 文本
            </label>
            <label class="radio-inline">
              <input type="radio" name="display_type" value="2" ng-model="addm.display_type"> 代码
            </label>
            <label class="radio-inline">
              <input type="radio" name="display_type" value="0" ng-model="addm.display_type"> 表格
            </label>
          </div>
          <hr>
          <div ng-show="addm.display_type != 0">
            <textarea class="form-control" rows="3" ng-model="addm.text"></textarea>
          </div>
          <div ng-show="addm.display_type == 0">
            <table class="table table-bordered">
              <thead>
                <tr>
                  <th class="text-center col-md-3">参数</th>
                  <!-- <th class="text-center col-md-2">是否必须</th> -->
                  <th class="text-center col-md-7">说明</th>
                  <th class="text-center col-md-2">
                    <button type="button" 
                    class="btn btn-success"
                    ng-click="addtr()"
                    >新增</button>
                  </th>
                </tr>
              </thead>
              <tbody>
                <tr ng-repeat="table in addm.tablearr">
                  <td><input type="text" class="form-control"
                  ng-model="table.k"
                  ></td>
                  <td><input type="text" class="form-control"
                  ng-model="table.v"
                  ></td>
                  <!-- <td><input type="text" class="form-control"
                  ng-model="table.describe"
                  ></td> -->
                  <td class="text-center">
                    <button type="button" 
                    class="btn btn-danger"
                    ng-click="deltr($index)"
                    >删除</button>
                  </td>
                </tr>
              </tbody>
            </table>
          </div>

      </div>
      <div class=" col-md-2">
        <button type="button" class="btn btn-default btn-block btn-primary" 
        ng-click="add()"
        >
         添加 <span class="glyphicon glyphicon-plus-sign" ></span> 
        </button>
     
      </div>
     </div>
  </div>

  <br>
<br>
<br>

</div>

